//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2021 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.

import SotoCore

/// Error enum for MigrationHubConfig
public struct MigrationHubConfigErrorType: AWSErrorType {
    enum Code: String {
        case accessDeniedException = "AccessDeniedException"
        case dryRunOperation = "DryRunOperation"
        case internalServerError = "InternalServerError"
        case invalidInputException = "InvalidInputException"
        case serviceUnavailableException = "ServiceUnavailableException"
        case throttlingException = "ThrottlingException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize MigrationHubConfig
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// You do not have sufficient access to perform this action.
    public static var accessDeniedException: Self { .init(.accessDeniedException) }
    /// Exception raised to indicate that authorization of an action was successful, when the DryRun flag is set to true.
    public static var dryRunOperation: Self { .init(.dryRunOperation) }
    /// Exception raised when an internal, configuration, or dependency error is encountered.
    public static var internalServerError: Self { .init(.internalServerError) }
    /// Exception raised when the provided input violates a policy constraint or is entered in the wrong format or data type.
    public static var invalidInputException: Self { .init(.invalidInputException) }
    /// Exception raised when a request fails due to temporary unavailability of the service.
    public static var serviceUnavailableException: Self { .init(.serviceUnavailableException) }
    /// The request was denied due to request throttling.
    public static var throttlingException: Self { .init(.throttlingException) }
}

extension MigrationHubConfigErrorType: Equatable {
    public static func == (lhs: MigrationHubConfigErrorType, rhs: MigrationHubConfigErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension MigrationHubConfigErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
